home *** CD-ROM | disk | FTP | other *** search
- ; DESC: Opens a file V1.00
- ; IN: *{SEG_VAL} segment and
- ; *{OFFSET} offset of filename as ASCIIZ strng
- ; *{ACC_CODE} access code of file (0:read,1:write,2:read write)
- ; OUT: *{HANDLE} handle of file
- ; SAMPLE: Callm OPEN,<SEG_VAL,OFFSET,ACC_CODE>,<HANDLE>
- #####################################################################
-
- Extrn PUSHALL:Near
- Extrn POPALL:Near
- Extrn ERRORMSG:Near
-
- OPENC Segment
- Assume CS:OPENC
- Public OPEN
- ;notice.
- DB 'OPEN - V1.00, Copyright 1987, CoreTechs ',0DH,0AH
-
- OPEN Proc Near ;opens a file.
- Call PUSHALL
-
- Pop AX ;get the access code.
- Pop DX ;get the filename offset.
- Pop DS ;get the segment offset.
-
- Mov AH,3DH ;open a file.
- Int 21H
- Jc ERROR ;if an error report it.
-
- Push AX ;if no error return handle.
- Call POPALL
- Ret
-
- ERROR: Push AX ;report error and abort.
- Call ERRORMSG
-
- OPEN Endp
- OPENC Ends
- End